Standardised logging timestamp to ISO8601 #1625
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Atlantis version - atlantis 0.17.0
Issue -
With the current format of logs, the timestamp is printed in the format -
{"level":"info","ts":1623266081.273087,"caller":"server/server.go:715","msg":"All in-progress operations complete, shutting down","json":{}}
This particular format makes it really difficult or impossible to ingest atlantis logs into logging system like ELK. Also to the bare eye it is difficult to understand the format.
Solution offered -
Zap logs can be formatted to be printed in ISO8601 standards. This has been configured in the logger initialisation. With this configs logs are printed in the below format -
{"level":"info","ts":"2021-06-10T00:44:51.559+0530","caller":"server/server.go:148","msg":"Policy Checks are enabled","json":{}}
This format is more readable and easier to ingest into logging system like ELK.